#include <glib.h>

#define SIZE 5

struct _GStringChunk
{
  GHashTable *const_table;
  GSList     *storage_list;
  gsize       storage_next;
  gsize       this_size;
  gsize       default_size;
};

static void
test_string_chunks (void)
{
    int i = 0;
    GStringChunk *sc = NULL;
    gchar *str[SIZE];

    g_printf("\n");

    sc = g_string_chunk_new (4096);
    str[0] = g_string_chunk_insert(sc, "AA");
    str[1] = g_string_chunk_insert_const(sc, "AA");
    str[2] = g_string_chunk_insert_const(sc, "BBBB");
    str[3] = g_string_chunk_insert_const(sc, "BBBB");
    str[4] = g_string_chunk_insert(sc, "CCC");

    for(i=0;i<SIZE;i++) {
        g_print("str[%d]: %s \n", i, str[i]);
    }

    g_print("chunk this_size=%d, storage_next=%d \n", (gint)sc->this_size, (gint)sc->storage_next);

    g_string_chunk_clear(sc);
    g_string_chunk_free(sc);    
}

int main (int argc, char *argv[])
{
  g_test_init(&argc, &argv, NULL);

  g_test_add_func("/string/test_string_chunks", test_string_chunks);

  return g_test_run();
}